//
// Created by tym on 2020/6/1.
//

#include <stdio.h>
#include "../include/gverb.h"
#define TYPE float
int main(int argc, char** argv){
/*    int srate, float maxroomsize, float roomsize,
    float revtime,
    float damping, float spread,
    float inputbandwidth, float earlylevel,
    float taillevel*/
    ty_gverb *gverb = gverb_new(1,1.0f,0.5f,0.5f,0.4f,0.5f,2,1.0f,1.0f);
    //float *in;
    TYPE infloat[441*10];
    //in = infloat;

    //float *out;
    TYPE outfloat[441*10];
    //out = outfloat;
    FILE *fpIn = NULL;
    fpIn = fopen("D:\\audiostudy\\gverb-master\\source\\in16be.pcm", "rb+");

    if(!fpIn){
        printf("open in File error");
    }
    FILE *fpOut = NULL;
    fpOut = fopen("D:\\audiostudy\\gverb-master\\source\\out.pcm", "wb+");
    if(!fpOut){
        printf("open out File error");
    }
    //for
    printf("sizeof(float):%d",sizeof(TYPE));
    int size=0;
    memset(infloat,441*10,sizeof(TYPE));
    while( (size = fread(infloat,sizeof(TYPE),441*10,fpIn))>0){
        gverb_do(gverb,0.0f,infloat,outfloat);
        fwrite(outfloat,sizeof(TYPE),441*10,fpOut);
    }
    fclose(fpIn);
    fclose(fpOut);
}
